package com.tec.security.controller;

import com.tec.security.service.AuditLogService;
import com.tec.security.service.NewsLogService;
import com.tec.security.utils.other.LimitPage;
import com.tec.security.utils.response.Result;
import com.tec.security.utils.security.service.UserlogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "日志接口")
@RequestMapping("/Log/")
public class LogController {
    private final UserlogService userlogService;
    private final NewsLogService newsLogService;
    private final AuditLogService auditLogService;
    @Autowired
    public LogController(UserlogService userlogService, NewsLogService newsLogService, AuditLogService auditLogService) {
        this.userlogService = userlogService;
        this.newsLogService = newsLogService;
        this.auditLogService = auditLogService;
    }

    /**
     * @description 账号操作日志
     * @author 陆林
     * @date 2023-11-30
     */
    @ApiOperation(value = "账号操作日志")
    @PostMapping("userLogList")
    public Result userLogList(LimitPage limitPage,String type){
        return Result.success(userlogService.allUserLogList(limitPage,type));
    }

    /**
     * @description 新闻操作日志
     * @author 陆林
     * @date 2023-11-30
     */
    @ApiOperation(value = "新闻操作日志")
    @PostMapping("newsLogList")
    public Result newsLogList(LimitPage limitPage,String type){
        return Result.success(newsLogService.allNewsLogList(limitPage,type));
    }

    /**
     * @description 审核操作日志
     * @author 陆林
     * @date 2023-11-30
     */
    @ApiOperation(value = "审核操作日志")
    @PostMapping("auditLogList")
    public Result auditLogList(LimitPage limitPage,String type){
        return Result.success(auditLogService.allAuditLogList(limitPage,type));
    }
}
